#ifndef _DKGLCONTROLLER_H_
#define _DKGLCONTROLLER_H_

#include <string>
#include <list>

namespace DKGL
{

//define key codes
enum DKGL_KEYCODES
{
	DK_BACK				= 0x08,// 	BACKSPACE key
	DK_TAB					= 0x09, // 	TAB key
	DK_CLEAR				= 0x0C ,//	CLEAR key
	DK_RETURN 			= 0x0D ,//	ENTER key
	DK_SHIFT 				= 0x10 	,//SHIFT key
	DK_CONTROL 		= 0x11 	,//CTRL key
	DK_MENU 				= 0x12 	,//ALT key
	DK_PAUSE 			= 0x13 	,//PAUSE key
	DK_CAPITAL 			= 0x14 	,//CAPS LOCK key
	DK_ESCAPE 			= 0x1B ,//	ESC key
	DK_SPACE 			= 0x20 	,//SPACEBAR
	DK_PRIOR 				= 0x21 	,//PAGE UP key
	DK_NEXT 				= 0x22 	,//PAGE DOWN key
	DK_END 				= 0x23 	,//END key
	DK_HOME 				= 0x24 	,//HOME key
	DK_LEFT 				= 0x25 	,//LEFT ARROW key
	DK_UP 					= 0x26 	,//UP ARROW key
	DK_RIGHT 				= 0x27 	,//RIGHT ARROW key
	DK_DOWN 				= 0x28 	,//DOWN ARROW key
	DK_SELECT 			= 0x29 	,//SELECT key
	DK_PRINT 				= 0x2A ,//	PRINT key
	DK_EXECUTE 		= 0x2B ,//	EXECUTE key
	DK_SNAPSHOT 	=0x2C 	,//PRINT SCREEN key
	DK_INSERT 			= 0x2D ,//	INS key
	DK_DELETE 			= 0x2E ,//	DEL key
	DK_HELP 				= 0x2F ,//	HELP key
	DK_0 						= 0x30 ,//0 key
	DK_1						= 0x31 	,//1 key
	DK_2						= 0x32 	,//2 key
	DK_3						= 0x33 	,//3 key
	DK_4						= 0x34 	,//4 key
	DK_5						= 0x35 	,//5 key
	DK_6						= 0x36 	,//6 key
	DK_7						= 0x37 	,//7 key
	DK_8						= 0x38 	,//8 key
	DK_9						= 0x39 	,//9 key
	DK_A						= 0x41 	,//A key
	DK_B						= 0x42 	,//B key
	DK_C						= 0x43 	,//C key
	DK_D						= 0x44 ,//	D key
	DK_E						= 0x45 	,//E key
	DK_F						= 0x46 	,//F key
	DK_G						= 0x47 	,//G key
	DK_H						= 0x48 	,//H key
	DK_I						= 0x49 	,//I key
	DK_J						= 0x4A ,//	J key
	DK_K						= 0x4B ,//	K key
	DK_L						= 0x4C ,//	L key
	DK_M						= 0x4D ,//	M key
	DK_N						= 0x4E ,//	N key
	DK_O						= 0x4F ,//	O key
	DK_P						= 0x50 	,//P key
	DK_Q						= 0x51 	,//Q key
	DK_R						= 0x52 	,//R key
	DK_S						= 0x53 	,//S key
	DK_T						= 0x54 	,//T key
	DK_U						= 0x55 	,//U key
	DK_V						= 0x56 	,//V key
	DK_W						= 0x57,// 	W key
	DK_X						= 0x58,// 	X key
	DK_Y						= 0x59,// 	Y key
	DK_Z						= 0x5A,// 	Z key
	DK_NUMPAD0 		= 0x60,// 	Numeric keypad 0 key
	DK_NUMPAD1 		= 0x61,// 	Numeric keypad 1 key
	DK_NUMPAD2 		= 0x62,// 	Numeric keypad 2 key
	DK_NUMPAD3 		= 0x63,// 	Numeric keypad 3 key
	DK_NUMPAD4 		= 0x64,// 	Numeric keypad 4 key
	DK_NUMPAD5 		= 0x65,// 	Numeric keypad 5 key
	DK_NUMPAD6 		= 0x66,// 	Numeric keypad 6 key
	DK_NUMPAD7 		= 0x67,// 	Numeric keypad 7 key
	DK_NUMPAD8 		= 0x68,// 	Numeric keypad 8 key
	DK_NUMPAD9 		= 0x69,// 	Numeric keypad 9 key
	DK_SEPARATOR 	= 0x6C,// 	Separator key
	DK_SUBTRACT 	= 0x6D,// 	Subtract key
	DK_DECIMAL 		= 0x6E,// 	Decimal key
	DK_DIVIDE 			= 0x6F,// 	Divide key
	DK_F1 					= 0x70,// 	F1 key
	DK_F2 					= 0x71,// 	F2 key
	DK_F3 					= 0x72,// 	F3 key
	DK_F4 					= 0x73 	,//F4 key
	DK_F5 					= 0x74 	,//F5 key
	DK_F6 					= 0x75 	,//F6 key
	DK_F7 					= 0x76 	,//F7 key
	DK_F8 					= 0x77 	,//F8 key
	DK_F9 					= 0x78 	,//F9 key
	DK_F10 					= 0x79 	,//F10 key
	DK_F11 					= 0x7A ,//	F11 key
	DK_F12 					= 0x7B ,//	F12 key
	DK_F13 					= 0x7C ,//	F13 key
	DK_F14 					= 0x7D,// 	F14 key
	DK_F15 					= 0x7E,// 	F15 key
	DK_F16 					= 0x7F,// 	F16 key
	DK_F17 					= 0x80,// 	F17 key
	DK_F18 					= 0x81,// 	F18 key
	DK_F19 					= 0x82,// 	F19 key
	DK_F20 					= 0x83,// 	F20 key
	DK_F21 					= 0x84,// 	F21 key
	DK_F22 					= 0x85,// 	F22 key
	DK_F23 					= 0x86,// 	F23 key
	DK_F24 					= 0x87,// 	F24 key
	DK_NUMLOCK 		= 0x90,// 	NUM LOCK key
	DK_SCROLL 			= 0x91,// 	SCROLL LOCK key
	DK_LSHIFT 			= 0xA0,// 	Left SHIFT key
	DK_RSHIFT 			= 0xA1,// 	Right SHIFT key
	DK_LCONTROL 	= 0xA2,// 	Left CONTROL key
	DK_RCONTROL 	= 0xA3,// 	Right CONTROL key
	DK_LMENU 			= 0xA4,// 	Left MENU key
	DK_RMENU 			= 0xA5,// 	Right MENU key
	DK_PLAY 				= 0xFA,// 	Play key
	DK_ZOOM 				= 0xFB //	Zoom key
};

/*
	I provide two types mouse controller to use.
	one is virtual function, and one is function pointer.
                      
	                           MouseBasic
							           /\
                                      /  \
                                     /    \
MouseVF (Virtual Func)    MouseFP ( Function Ptr)
	                      
*/

class MouseBasic
{
public:
	MouseBasic()
	{  mLMBDown = mMMBDown = mRMBDown = false;
		mOffSetX = mOffSetY = 0;};

	~MouseBasic(){};

	void appOnMove(int x, int y);
		
	void appOnLeftPress(int x, int y);
	void appOnLeftRelease(int x, int y);

	void appOnMiddlePress(int x, int y);
	void appOnMiddleRelease(int x, int y);

	void appOnRightPress(int x, int y);
	void appOnRightRelease(int x, int y);

	inline bool beLMBDown(void) const {return mLMBDown;};
	inline bool beMMBDown(void) const {return mMMBDown;};
	inline bool beRMBDown(void) const {return mRMBDown;};

	inline int x() const { return mCurrentX; };
	inline int y() const { return mCurrentY; };

	inline int relX() const { return mOffSetX; };
	inline int relY() const { return mOffSetY; };

	inline int oriX(void) const {return mOriX;};
	inline int oriY(void) const {return mOriY;};

protected:
	int mOffSetX, mOffSetY;
	int mPrevX, mPrevY; // used to calculate offset
	int mOriX, mOriY;
	int mCurrentX, mCurrentY;

private:
	bool mLMBDown, mMMBDown, mRMBDown;
};

class MouseVF : public MouseBasic
{
public:
	MouseVF() {};
	virtual ~MouseVF() {};

	virtual void onlyMove(int x, int y) {};
	
	virtual void leftPress(int x, int y)    {};
	virtual void leftDrag(int x, int y)     {};
	virtual void leftRelease(int x, int y)  {};
	//virtual void leftDoubleClick(int x, int y){};

	virtual void middlePress(int x, int y)  {};
	virtual void middleDrag(int x, int y)   {};
	virtual void middleRelease(int x, int y){};

	virtual void rightPress(int x, int y)   {};
	virtual void rightDrag(int x, int y)    {};
	virtual void rightRelease(int x, int y) {};
	
	//virtual void Wheel(int x, int y, int z){}
};

class MouseFP : public MouseBasic
{
public:
	MouseFP();
	~MouseFP() {};

	void (*onlyMove)(int x, int y);

	void (*leftPress)(int x, int y);
	void (*leftDrag)(int x, int y);
	void (*leftRelease)(int x, int y);

	void (*middlePress)(int x, int y);
	void (*middleDrag)(int x, int y);
	void (*middleRelease)(int x, int y);

	void (*rightPress)(int x, int y);
	void (*rightDrag)(int x, int y);
	void (*rightRelease)(int x, int y);
};

class KeyBoardController
{
public:
	KeyBoardController();
	~KeyBoardController();

protected:


};

}
#endif